<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>滴滴法律</title>
	<link rel="stylesheet" type="text/css" href="css/normalize.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/jquery.form.js"></script>
	<script type="text/javascript" src="js/img.js"></script>
	<!--[if lt IE 9]> 
		<script> src="js/html5shiv.min.js"></script> 
	<![endif]-->
</head>
<body>
	<div class="well well-sm">律师管理 / 审核其他信息</div>
	<form class="form-horizontal" method="post" action="" enctype="multipart/form-data" id="agree-form" style="margin-top:10px;">
		<div class="form-group">
		    <label class="col-sm-2 control-label">头像</label>
		    <div class="col-sm-4">
		      <img id="preview" width="120px" height="150px"  src="img/120x120.png"/>
		      <div style="height: 5px;"></div>
		      <input type="file" class="form-control" placeholder="文件最大不可以超过300K" name="file" id="doc" datatype="*" nullmsg="请选择头像" onchange="javascript:setImagePreview();">
		    </div>
	  	</div>
	  <div class="form-group">
	    <label for="user-input" class="col-sm-2 control-label">姓名</label>
	    <div class="col-sm-4">
	      <input type="hidden" name="userid" value="${stu.userid}">
	      <input type="hidden" name="applyId" value="${stu.applyId}">
	      <input type="hidden" name="city" value="${stu.city}">
	      <input type="text" class="form-control" id="user-input" value="${stu.name}" name="name">
	    </div>
	  </div>
	  <div class="form-group">
	    <label class="col-sm-2 control-label">性别</label>
	    <div class="col-sm-4">
		    <label class="radio-inline">
				  <input type="radio" name="sex" id="inlineRadio1" value="1" <c:if test="${stu.sex == 1}">checked</c:if>> 男
				</label>
				<label class="radio-inline">
				  <input type="radio" name="sex" id="inlineRadio2" value="2" <c:if test="${stu.sex == 2}">checked</c:if>> 女
				</label>
			</div>
	  </div>
	  <div class="form-group">
	    <label for="user-input" class="col-sm-2 control-label">邮箱</label>
	    <div class="col-sm-4">
	      <input type="text" class="form-control" id="user-input" value="${stu.mail}" name="mail">
	    </div>
	  </div>
	  <div class="form-group">
	    <label for="user-input" class="col-sm-2 control-label">城市</label>
	    <div class="col-sm-2">
	      <select class="form-control" name="province">
	      	<option value="${stu.province}">${stu.provinceName}</option>
	      </select>
	    </div>
	  </div>
	  <div class="form-group">
	    <label for="user-input" class="col-sm-2 control-label">擅长</label>
	    <div class="col-sm-2">
	      <select class="form-control" name="speciala">
	      	<option value="${stu.speciala}">${stu.specialNameA}</option>
	      </select>
	    </div>
	  </div>
	  <div class="form-group">
	    <label for="user-input" class="col-sm-2 control-label">年限</label>
	    <div class="col-sm-2">
	      <select class="form-control" name="membership">
	      	<option value="${stu.membership}">${stu.membership}</option>
	      </select>
	    </div>
	  </div>
	  <div class="form-group">
	    <label for="user-input" class="col-sm-2 control-label">领域</label>
	    <div class="col-sm-2">
	      <select class="form-control" name="domain">
	      	<option value="${stu.domain}">${stu.domain}</option>
	      </select>
	    </div>
	  </div>
	  <div class="form-group">
	  	<div class="col-sm-offset-2 col-sm-4">
	  		<input type="text" class="form-control" id="address" value="${stu.address}" name="address">
	  	</div>
	  </div>
	  <div class="form-group">
	  	<div class="col-sm-offset-2 col-sm-4">
	  		<textarea class="form-control" id="intro" name="intro" placeholder="请填写律师介绍" rows="3">这个家伙很懒什么都没有留下</textarea>
	  	</div>
	  </div>
	  <div class="form-group">
	    <div class="col-sm-offset-2 col-sm-10">
	      <button type="button" id="agree" class="btn btn-success">确认</button>
	      <button type="button" id="refuse" class="btn btn-danger">拒绝</button>
	    </div>
	  </div>
	</form>
</body>
<script type="text/javascript">
	$("#agree").on('click',function(){
		var flag = true;
		var name = $('#name').val();
		var mail = $('#mail').val();
		var membership = $('#membership').val();
		var address = $('#address').val();
		var intro = $('#intro').val();
		if (name == "") {
		 	alert("请填写正确的姓名！");
		 	flag = false;
		 }else if (mail == "") {
		 	alert("请填写正确的邮箱！");
		 	flag = false;
		 }else if (membership == "") {
		 	alert("请填写正确的年限！");
		 	flag = false;
		 }else if (address == "") {
		 	alert("请填写正确的地址！");
		 	flag = false;
		 }else if (intro == "") {
		 	alert("请填写正确的简介！");
		 	flag = false;
		 }
		 if (flag) {
		 var options = {
				 type:"post",
        		 url:"lawyer/student/agree",
		   	     dataType:'json',    
		   	     success: function (data){
		   	     		alert(data.msg);
        				if (data.code == 200) {
        					location.href = "lawyer/student/apply";
        				}else{
        					alert("审核失败！请重试！");
        				}
		   	  		}
   	     	  };
		 $('#agree-form').ajaxSubmit(options);
		  }
		});
		
		$("#refuse").on('click',function(){
		 	var applyId = $("input[name='applyId']").val();
		 	$.ajax({
        	type:"get",
        	url:"lawyer/refuse/student/" + applyId,
        	success:function(data){
        		alert(data.msg);
        		if (data.code == 200) {
        			location.href = "lawyer/student/apply";
        		}else{
        			alert("操作失败！请重试！");
        		}
        	  }
			});
		});
</script>
</html>